import ImageWall from "@/components/data-manage/detail/imageWall";
import ToolBar from "@/components/data-manage/detail/toolBar";
import { Record, getRecordList } from "@/external-api";
import { GetServerSideProps } from "next";

type Props = {
  records: Record[];
};

export default function DatasetDetail({ records }: Props) {
  return (
    <>
      <ToolBar></ToolBar>
      <ImageWall records={records}></ImageWall>
    </>
  );
}

export const getServerSideProps = (async (context) => {
  const records: Record[] = await getRecordList(
    Number.parseInt(context.query.id as string)
  );
  return { props: { records } };
}) satisfies GetServerSideProps<Props>;
